<template>
   <div>
     <!-- 通过 props 传递参数 -->
    <School
      :school-name="appSchoolName" 
      :school-data="appSchoolData"
      
      @school-info="handleSchoolInfo"
    />
    <!-- 事件函数的小括号：()可有可无   接受参数的方法不可以写小括号() -->
    <Student/>
    <p>收到学校数据: {{ receivedSchoolData }}</p>

   </div>
</template>
<script>
import  School  from "./components/School.vue";
import  Student  from "./components/Student.vue";
export default {
   name: 'App',
   components: {
    School,Student
     
   },
   mixins: [],
   props: {
     
   },
   data() {
     return {
      appSchoolName: '北京大学',
      appSchoolData: {
        location: '北京',
        established: 1898
      },
      receivedSchoolData: null
       
     }
   },
   computed: {
     
   },
   watch: {
     
   },
   mounted() {
     
   },
   methods: {
    handleSchoolInfo(data){
      console.log(data);
      
      this.receivedSchoolData=data

    }
     
   }
};
</script>
<style>
*{
  padding: 0;
  margin: 0;
}
</style>